#pragma once
#include"AbstractLayer.h"

class BirdThrower;
class GrasviationListener;

class Graviation : public AbstractLayer
{
public:
	friend class GrasviationListener;

	createScene(Graviation)
		
	CREATE_FUNC(Graviation)
	
	bool init();

	void box2DAppReady() override;

	void update(float dt) override;

	virtual bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event);

	virtual void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *unused_event);

	virtual void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *unused_event);

	void onExit() override;
private:
	b2Body* planet;
	b2Body* bird;
	GrasviationListener* listener;
	BirdThrower* birdManager;
	b2Body *sensor;
};
